package recursion;

public class RecursionFibonExample {

	public static void main(String[] args) {

		RecursionFibonExample re = new RecursionFibonExample();
		System.out.println(re.getNthFibonacci(5));
		
	}

	public int getNthFibonacci(int n) {

		if (n < 1) {
			return -1;
		} else if (n == 1 || n == 2) {
			return 1;
		}

		return getNthFibonacci(n-2) + getNthFibonacci(n-1);
	}

}
